package edu.ybu.manage.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import edu.ybu.manage.mapper.UserMapper;
import edu.ybu.manage.pojo.User;
import edu.ybu.manage.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public User selectByUsername(User user) {
        QueryWrapper<User> userQueryWrapper = new QueryWrapper<>();
        userQueryWrapper.eq("username",user.getUsername());
        return userMapper.selectOne(userQueryWrapper);
    }

    @Override
    public Integer insertUser(User user) {
        return userMapper.insert(user);
    }
}
